
<%@ page import="id.co.gomobile.assessment.Assignment" %>

<%@page import="id.co.gomobile.assessment.Test"%>
<%@page import="id.co.gomobile.assessment.User"%><html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'assignment.label', default: 'Assignment')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <g:render template="/shared/navigation" />

        <div class="body">
            
        <h1>Assign a Test</h1>

        <g:if test="${flash.message}">
        <div class="message">${flash.message}</div>
        </g:if>
            
        <g:hasErrors bean="${assignmentInstance}">
        <div class="errors">
            <g:renderErrors bean="${assignmentInstance}" as="list" />
        </div>
        </g:hasErrors>
            
        <g:form action="save" method="post" >
                
        <div class="form">

        <fieldset>        
        <h3>Create Assignment</h3>

        <label for="name" class="required ${hasErrors(bean: itemInstance, field: 'test', 'errors')}">Test :</label>
        <div class="value">
            <g:select name="test.id" from="${Test.list()}" optionKey="id" optionValue="name" value="${itemInstance?.test?.id}" />
        </div>

        <br/>

        <label for="name" class="required ${hasErrors(bean: itemInstance, field: 'user', 'errors')}">User :</label>
        <div class="value">
            <g:select name="user.id" from="${User.list()}" optionKey="id" optionValue="username" value="${itemInstance?.user?.id}" />
        </div>

        <br/>
        <br/>
        
        <div class="buttons">
            <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
        </div>

        </fieldset>
        </div>
    
    </g:form>
    </div>
    
    </body>
</html>
